#!/bin/bash

package=gmttemplates
stow_address=/opt/stow
tar_address=/usr/local

# Prepare the working directory
if [[ ! -d ${stow_address}/${package}/sbin ]]; then
	sudo mkdir ${stow_address}/${package}
	sudo mkdir ${stow_address}/${package}/sbin
fi

#找到所有后缀名为.py的脚本名称 存入数组
scriptName=( `ls *.sh` )
for element in ${scriptName[@]}; do
	#排除configure.sh
	if [[ $element != "configure.sh" && $element != "stow-config.sh" ]]; then
		sudo cp ${element} ${stow_address}/${package}/sbin
	fi
done

# 使用stow创建链接
sudo stow -d ${stow_address} -t ${tar_address} -S ${package}